/*
Author: Ryan Westfall
Class Name: Hospital
Functionality: This class will create the hospital object which will inherite Facilities object
Version number: 0.0.1
Testers: needs to be tested
Date written:October 24, 2011
Date tested: needs to be tested
To-do:
*/


package disease;

public class Hospital extends Facilities{
    private double saveRate;
    private boolean zombieAntidote;
    private static int antidoteCost = 100000;
    private static boolean maxLevel = false;
    
    public Hospital(String type) {
        super(type);
        saveRate = 0.0;//should go up to .50  that is equal to 50%
        zombieAntidote = false;//this will make the save rate 80%  cost a ton of money
    }
    public boolean upGradeHospital(){
        //if return true then subtract money
        //do in game board
        if (saveRate < 0.5 && on == true){
        	//System.out.println("Hospital upgraded successfully");
        	//super.upgradeable = true;
            //goes up 10%  can't be 100
        	if (saveRate+0.1 > 0.5){
        		System.out.println("hosptial upgraded, max saverate");
        		saveRate = 0.5;
        		super.upgradeBuilding();
        		return true;
        	}
        	else{
        		System.out.println("hospital upgraded, 10% better saverate");
        		saveRate += 0.1;
        		super.upgradeBuilding();
        		return true;
        	}
        }else if(saveRate >= 0.5){
        	//saveRate is as high as possible
        	System.out.println("Hospital is at max level");
        	maxLevel = true;
        	return false;
        }
//        else if (on == false){
//        	System.out.println("hospital not upgraded, closed");
//        	upgradeable = false;
//        	return false;
//        }
        else{ 
        	System.out.println("Cannot upgrade further.");
        	//super.upgradeable = false;
            return false;
        }
    }

    public boolean buyAntidote(){
        //check money and antidote then buy
        //buy antidote to make saveRate 80%
        if(zombieAntidote == false){
            zombieAntidote = true;
            saveRate = 0.8;
            return true;
            //now decrease money from bank
        }
        else{
            return false;//meaning already have it
        }
    }
    public double getSaveRate(){
        //this will give saveRate
        return saveRate;
    }
//    public double getInfectionRate(){
//    	return infectionRate;
//    }
    public boolean getAntidote(){
        return zombieAntidote;
    }
    public int getAntidoteCost(){
    	return antidoteCost;
    }
    public boolean canUpgrade(){
    	return !maxLevel;
    }  
    public boolean getMaxLevel(){
    	return maxLevel;
    }
}